home *** CD-ROM | disk | FTP | other *** search
- Subject: Re: Reading Formatted Text
- Sent: 6/10/96 10:24 PM
- Received: 6/11/96 9:12 AM
- From: Jim Lloyd, jim@melongem.com
- Reply-To: ODF Interest, ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
-
- At 6:32 PM 6/10/96, Serge Froment wrote:
- >Dear ODF Team:
- >
- >What is the proper way to read tab-delimited formatted text from the
- >clipboard. I want to loop, reading up to the next tab or return and parsing
- >the text.
- >
- >I have looked at FW_CString, which has methods for searching a character,
- >and FW_CTextReader, which don't have such methods. I am not clear if I must
- >use one or the other, or both.
-
- As you've noticed, ODF R1 doesn't provide anything that exactly meets your
- needs. FW_CTextReader is the most appropriate ODF class for this task. The
- idea is to create tool classes that use TextReader interfaces. For
- example, you might write a lexical analyzer class along these lines:
-
-
- class CLexicalAnalyzer
- {
- public:
- CLexicalAnalyzer(FW_CTextReader& reader);
- // create an analyzer and attach it to the given text reader
-
- void SkipWhiteSpace();
- void ReadString(FW_CString& string);
- ....
-
- private:
- FW_CTextReader& fReader;
- };
-
- By using the FW_CTextReader interface, you'll be able to use this tool for
- reading from any source of text.
- To read text from the clipboard you would either create a subclass of
- FW_OTextRunReader for reading directly from the clipboard, or read the
- entire clipboard into a memory block and use FW_OMemoryRunReader.
-
- Note, FW_CTextReader and FW_CSink have some similarities. FW_CTextReader
- is designed for reading text, including dealing with double-byte
- characters. FW_CSink is purely for binary data in the form of bytes.
- FW_CReadableStream is a layer on top of FW_CSink for reading data at a
- higher level, such as integers and strings (and polymorpic objects via the
- archiver). The CLexicalAnalyzer class is similar in some respects to
- FW_CReadableStream; i.e. a layer for reading data at a higher level of
- abstraction. ODF R1 doesn't provide any classes built on top of
- FW_CTextReader, though it was something we considered doing at one time.
-
- Jim Lloyd
-
-